package com.bishe.cyh.controller;

import com.bishe.cyh.mode.Result;
import com.bishe.cyh.service.UploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;


/**
 * @Author: Poppin
 * @Date: 2022/1/11 20:58
 * @Version: 1.0
 */

@RequestMapping("/api")
@RestController
public class UploadController {

    private UploadService uploadService;

    @Autowired
    public void setUploadService(UploadService uploadService){
        this.uploadService = uploadService;
    }


    @PostMapping("/upload")
    public Result upload(@RequestParam(value = "file")MultipartFile file) throws IOException {
        return uploadService.uploadFile(file);
    }
    @GetMapping("/Getdata")
    public Result Getdatalist(){
        return uploadService.DataList();
    }

    @GetMapping("/deletedata")
    public Result Deleta(@RequestParam("id")Integer id){
        return uploadService.Delete(id);
    }

}
